home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
001
/
pibt40s1.arc
/
DUPL.MOD
< prev
next >
Wrap
Text File
|
1986-09-11
|
4KB
|
57 lines
(*--------------------------------------------------------------------------*)
(* Dupl -- Duplicate a character n times *)
(*--------------------------------------------------------------------------*)
FUNCTION Dupl( Dup_char : Char; Dup_Count: INTEGER ) : AnyStr;
(*--------------------------------------------------------------------------*)
(* *)
(* Function: Dupl *)
(* *)
(* Purpose: Duplicate a character n times *)
(* *)
(* Calling Sequence: *)
(* *)
(* Dup_String := Dupl( Dup_Char: Char; Dup_Count: INTEGER ): AnyStr; *)
(* *)
(* Dup_Char --- Character to be duplicated *)
(* Dup_Count --- Number of times to duplicate character *)
(* Dup_String --- Resultant duplicated string *)
(* *)
(* Note: If Dup_Count <= 0, a null string is returned. *)
(* *)
(* Calls: None *)
(* *)
(* *)
(* Remarks: *)
(* *)
(* This routine could be programmed directly in Turbo as: *)
(* *)
(* VAR *)
(* S : AnyStr; *)
(* *)
(* BEGIN *)
(* *)
(* FillChar( S[1], Dup_Count, Dup_Char ); *)
(* S[0] := CHR( Dup_Count ); *)
(* *)
(* Dupl := S; *)
(* *)
(* END; *)
(* *)
(*--------------------------------------------------------------------------*)
BEGIN (* Dupl *)
INLINE( $16/ (* PUSH SS ; Push stack ptr *)
$07/ (* POP ES ; For result addressing *)
$8B/$4E/$04/ (* MOV CX,[BP+4] ; Pick up dup count *)
$88/$4E/$08/ (* MOV [BP+8],CL ; Store result length *)
$8B/$46/$06/ (* MOV AX,[BP+6] ; Get char to duplicate *)
$8D/$7E/$09/ (* LEA DI,[BP+9] ; Result address *)
$FC/ (* CLD ; Set direction flag *)
$F3/$AA (* REPLSTOSB ; Perform duplication *)
);
END (* Dupl *);